<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld" prefix="vectrics" %>

<%@ page import="java.util.Collections" %>
<%@ page import="java.util.List" %>
<%@ page import="org.vectrics.recruiter.RecruitServiceLocator" %>
<%@ page import="org.vectrics.recruiter.job.JobStatusType" %>

<%
  List<JobStatusType> allStatus = RecruitServiceLocator.getJobProvider().findJobStatus();
 
  for (JobStatusType s : allStatus) {
	  s.setDescription(s.getDescription(request.getLocale()));
  }
  Collections.sort(allStatus);
  request.setAttribute("allStatus", allStatus);
  
  String idLocation = request.getParameter("location");
  if ((request.getAttribute("location")!=null)){
	  if(((String)request.getAttribute("location")).trim().equals("")){
		  idLocation = "0";
	  }else{
		  idLocation = (String) request.getAttribute("location");
	  }
  }
  
%>

<jsp:useBean id="searchForm" class="org.vectrics.recruiter.struts.JobSearchForm" scope="request"/>

<html:form action="/admin/jobs/index" method="post">
	<table width="100%">
		<tr>
			<td valign="TOP">
				<table width="96%" border="0" cellspacing="3" >
					<tr>
						<td valign="top" width="20%" >
							<font class="formLabelClass"> <bean:message key="prompt.job.ReferenceId"/> </font>
						</td>
						<td valign="top" width="30%">
							<html:text property="referenceId" size="200" styleClass="formEditClass" />
						</td>
						<td valign="top" width="20%"  >
							<font class="formLabelClass"> <bean:message key="prompt.job.title"/> </font>
						</td>
						<td valign="top" width="30%">
							<html:text property="title" size="200" styleClass="formEditClass" />
						</td>
					</tr>				
					<tr>
       					<td valign="top">
							<font class="formLabelClass">  <bean:message key="prompt.job.primary.recruiter"/> </font>
						</td>
						<td valign="top">
							<vectrics:personPicker	contextPath="/hrs-intranet"	remoteMethod="get.matching.recruiter" caption="Primary recruiter" paramName="primaryRecruiter" popupLeft="200" popupTop="100" styleClase="formStaticClass" />
						</td>
						<td valign="top">
							<font class="formLabelClass">  <bean:message key="prompt.job.requester"/> </font>
						</td>
						<td valign="top">
							<vectrics:personPicker contextPath="/hrs-intranet" remoteMethod="get.matching.manager" caption="Requester" paramName="requester" popupLeft="200" popupTop="100" styleClase="formStaticClass" />
						</td>
					</tr>
					<tr>
						<td valign="top">
							<font class="formLabelClass">  <bean:message key="prompt.job.Location"/> </font>
						</td>
						<td valign="top">
							<vectrics:locationCombo 
								property="location" 
								locationType="job.location"
								styleClass="formComboClass" 
								selected="<%=idLocation %>"  />
						</td>
						<td valign="TOP" align="left"><font class="formLabelClass"> <bean:message key="prompt.job.Status"/> </font></td>
						<td valign="top">
							<html:select property="activeStatus" styleClass="formComboClass">
								<html:option value="">  <bean:message key="prompt.job.status.all" /> </html:option>
								<html:options 
					             collection="allStatus"
					             labelProperty="description" 
					             property="code"
					             />
							</html:select>
						</td>
					</tr>
				</table>									
			</td>
		</tr>
	</table>
	<table width="96%" border="0" cellspacing="5" >
		<tr>
			<td valign="TOP" align="right" width="50%" >
				<vectrics:formButton elementId="ok.btn" code="button.ok" phraseCode="button.ok" value="submit" name="submit"/>
			</td>
			<td valign="TOP" align="left" width="50%" >
				<vectrics:formButton elementId="cancel.btn" code="button.cancel" phraseCode="button.reset" value="reset" name="reset"/>
			</td>
		</tr>
	</table>
	
</html:form>

<!-- show table with featured jobs -->
<vectrics:jobList 
	permissionJobView="view_JO_details"
	permission="view_JO_list"
/>
